Clear["`*"]

a={{1,1,-1},{2,3,f},{1,g,3}}

Dimensions[a]

a//MatrixForm

b={1,5,2}

x={x1,x2,x3}

d=Det[a]

?FactorList

FactorList[d]

FactorList[2 2 3 4 3 3 3(y-1)(y-2)(y-3)(y-1)]

Factor[d]

NumberQ[d]

a

a//MatrixForm

b

x

at=Transpose[a]

at//MatrixForm

?a

?at

at1=at/.at[[1]]->b

at1=Transpose[at1]

at1//MatrixForm

dx=Det[at1]/Det[a]

Table[i^2, {6}]

at=Transpose[a];
Table[Det[at/.at[[i]]->b],{i,Length[a]}]/Det[a]

{x1,x2,x3}=%

x1

x2

x3

a

x

Clear[x1,x2,x3]

x

b

{x1,x2,x3}=={1,2,3}

x1

Thread[Rule[ {x1,x2,x3},{1,2,3}]]

ToRules[{x1,x2,x3}=={1,2,3}]

x

a

b

Clear[Cramer];
Cramer[a_,x_,b_]:=Module[{i, at,l, d, sol1,sol2},
		l=Length[a];
		at=Transpose[a];
		d=Det[a];
		sol1=Table[Det[Transpose[at/.at[[i]]->b]],{i,l}]/d;
		(*Print["sol1: ",sol1];*)
		sol2={};
		For [i=1, i<=l, i++, AppendTo[sol2,{x[[i]],sol1[[i]]} ]];
		(*Print[sol2];*)
		ToRules[x==sol1]]

Cramer[a,x,b]

a

x

b

f=10

g=20

a

Cramer[a,x,b]

a={{1,1,-1},{2,3,4},{1,5,3}}

Cramer[a,x,b]

a={{1,5,7,-2},{2,4,8,3},{3,6,5,-9},{1,2,3,-4}}

b={-3,2,-9,-5}

x={x1,x2,x3,x4}

Cramer[a,x,b]

StringJoin["x",ToString[1]]

h[n_]:=Table[RandomInteger[100],{n}];
CreateSystem[n_]:=Module[{a,x,b},
a=Table[h[n],{n}];
b=h[n];
x=Table[StringJoin["x",ToString[i]],{i,n}];
{a,x,b}]

s=CreateSystem[4]

a=s[[1]]

b=s[[3]]

x=s[[2]]

Cramer[a,x,b]